#include "fxcc/yml/Serializer.h"
#include "fxcc/core/graph/common/Node.h"

using namespace fxcc::yml;
using namespace fxcc::graph::common;

template<>
void Serializer::Encode<Node>(YAML::Node& node, const Node& inst)
{
    SetVariable<std::string>(node, "m_Name", inst.m_Name);
    SetVariable<Transform>(node, "m_Offset", inst.m_Offset);
    SetArrayVariable<unsigned int>(node, "m_Meshes", inst.m_Meshes);
    SetArrayVariable<unsigned int>(node, "m_Cameras", inst.m_Cameras);
    SetArrayVariable<unsigned int>(node, "m_Lights", inst.m_Lights);
    SetPtrArrayVariable<Node>(node, "m_Childern", inst.m_Childern);


}


template<>
bool Serializer::Decode<Node>(const YAML::Node& node, Node& inst)
{
    GetVariable<std::string>(node, "m_Name", inst.m_Name);
    GetVariable<Transform>(node, "m_Offset", inst.m_Offset);
    GetArrayVariable<unsigned int>(node, "m_Meshes", inst.m_Meshes);
    GetArrayVariable<unsigned int>(node, "m_Cameras", inst.m_Cameras);
    GetArrayVariable<unsigned int>(node, "m_Lights", inst.m_Lights);
    GetPtrArrayVariable<Node>(node, "m_Childern", inst.m_Childern);

	return true;
}
